a1 = int(input())
a2 = int(input())
k1 = int(input())
k2 = int(input())
n = int(input())
mn = n - ((k1 - 1) * a1 + (k2 - 1) * a2)
if mn < 0:
mn = 0
if k1 < k2:
mx = min(n // k1, a1)
n -= mx * k1
mx += min(n // k2, a2)
else:
mx = min(n // k2, a2)
n -= mx * k2
mx += min(n // k1, a1)
print(mn, mx)
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
const int N = 1e5 + 9, MOD = 1000000007;
typedef long long ll;
using namespace std;
void solve()
{
ll a1, a2, k1, k2, n, n2, mx = 0;
cin >> a1 >> a2 >> k1 >> k2 >> n;
n2 = n;
n -= ((a1 * (k1 - 1)) + (a2 * (k2 - 1)));
cout << max(n, 0LL) << " ";
if (k1 > k2)
{
swap(a1, a2);
swap(k1, k2);
}
mx = min(a1, n2 / k1);
n2 -= mx * k1;
if (n2 >= 0)
mx += min(a2, n2 / k2);
cout << mx;
}
int main(void)
{
IO;
int t = 1;
// cin >> t;
while (t--)
solve();
return 0;
}
1029A - Many Equal Substrings | 1675D - Vertical Paths |
1271C - Shawarma Tent | 805A - Fake NP |
1163A - Eating Soup | 787A - The Monster |
807A - Is it rated | 1096A - Find Divisible |
1430C - Numbers on Whiteboard | 1697B - Promo |
208D - Prizes Prizes more Prizes | 659A - Round House |
1492C - Maximum width | 171B - Star |
1512B - Almost Rectangle | 831B - Keyboard Layouts |
814A - An abandoned sentiment from past | 268C - Beautiful Sets of Points |
1391C - Cyclic Permutations | 11A - Increasing Sequence |
1406A - Subset Mex | 1365F - Swaps Again |
50B - Choosing Symbol Pairs | 1719A - Chip Game |
454B - Little Pony and Sort by Shift | 1152A - Neko Finds Grapes |
1719B - Mathematical Circus | 1719C - Fighting Tournament |
1642A - Hard Way | 285C - Building Permutation |